package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOPeration{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入您要归还图书的书名：");
        String name = scanner.nextLine();

        int pos = bookList.books.indexOf(name);
        if (pos == -1) {
            System.out.println("没有找到您要归还的图书！！！");
            return;
        }
        Book book = (Book)bookList.books.get(pos);
        book.setIsborrow(false);
        System.out.println("归还成功！！");
        return;
    }
}
